//
//  TNMyHeadManView.m
//  跑跑快销
//
//  Created by ylife on 14-5-7.
//  Copyright (c) 2014年 ylife. All rights reserved.
//
#define HeadViewHeight 80
#define InfoCellHeight 50
#define LableWidth  70
#import "TNMyHeadManView.h"

@implementation TNMyHeadManView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor lightGrayColor];
        [self createView];
    }
    return self;
}

- (void)createView
{
    
    _myTableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 15, 320, 280)];
    [_myTableview registerClass:[HeadCell class] forCellReuseIdentifier:@"HeadCell"];
    [_myTableview registerClass:[InfoCell class] forCellReuseIdentifier:@"InfoCell"];
    [_myTableview registerClass:[ButtonCell class] forCellReuseIdentifier:@"ButtonCell"];
    [_myTableview setScrollEnabled:NO];
    [_myTableview setAllowsSelection:NO];
    
    
    [self addSubview:_myTableview];
    
}
@end



@implementation HeadCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, HeadViewHeight - 20, HeadViewHeight - 20)];
        _headImageView.layer.masksToBounds = YES;
        _headImageView.layer.cornerRadius = (HeadViewHeight - 20)/2;
        [self addSubview:_headImageView];
        
        _nameLab = [[UILabel alloc]initWithFrame:CGRectMake(HeadViewHeight, 0 , 320 - HeadViewHeight, HeadViewHeight)];
        [self addSubview:_nameLab];
    }
    return self;
}
@end



@implementation InfoCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UILabel *sexLable = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, LableWidth, InfoCellHeight)];
        [sexLable setText:@"性别"];
        [sexLable setTextAlignment:NSTextAlignmentCenter];
        [self addSubview:sexLable];
        
        UILabel *jobLable = [[UILabel alloc]initWithFrame:CGRectMake(0, InfoCellHeight, LableWidth, InfoCellHeight)];
        [jobLable setTextAlignment:NSTextAlignmentCenter];
        [jobLable setText:@"行业"];
        [self addSubview:jobLable];
        
        UILabel *signLable = [[UILabel alloc]initWithFrame:CGRectMake(0, InfoCellHeight * 2, LableWidth, InfoCellHeight)];
        [signLable setTextAlignment:NSTextAlignmentCenter];
        [signLable setText:@"签名"];
        [self addSubview:signLable];
        
        _sexLab = [[UILabel alloc]initWithFrame:CGRectMake(LableWidth, 0, 320 - InfoCellHeight, InfoCellHeight)];
        [self addSubview:_sexLab];
        
        _jodLab = [[UILabel alloc]initWithFrame:CGRectMake(LableWidth, InfoCellHeight, 320 - InfoCellHeight, InfoCellHeight)];
        [self addSubview:_jodLab];
        
        _signLab  = [[UILabel alloc]initWithFrame:CGRectMake(LableWidth, InfoCellHeight * 2, 320 - InfoCellHeight, InfoCellHeight)];
        [self addSubview:_signLab];
        
        //画虚线
        UILabel *lineLable = [[UILabel alloc]initWithFrame:CGRectMake(LableWidth, InfoCellHeight, 320 - InfoCellHeight, 1)];
        [lineLable setTextColor:[UIColor grayColor]];
        [lineLable setFont:[UIFont systemFontOfSize:7]];   //默认17
        lineLable.text = @"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
        [self addSubview:lineLable];
        
        UILabel *lineLable2 = [[UILabel alloc]initWithFrame:CGRectMake(LableWidth, InfoCellHeight * 2, 320 - InfoCellHeight, 1)];
        [lineLable2 setTextColor:[UIColor grayColor]];
        [lineLable2 setFont:[UIFont systemFontOfSize:7]];   //默认17
        lineLable2.text = @"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
        [self addSubview:lineLable2];

    }
    return self;
}
@end



@implementation ButtonCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _sendMsgButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 160, InfoCellHeight)];
        [_sendMsgButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        [_sendMsgButton setTitle:@"发消息" forState:UIControlStateNormal];
        [self addSubview:_sendMsgButton];
        
        _removeFriendButton = [[UIButton alloc]initWithFrame:CGRectMake(160, 0 ,160, InfoCellHeight)];
        [_removeFriendButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        [_removeFriendButton setTitle:@"删除好友" forState:UIControlStateNormal];
        [self addSubview:_removeFriendButton];
    }
    return self;
}
@end
